<?php
require 'MySQLExceptionClass.php';
require 'MySQLResultSetClass.php';
class MySQLConnect{
  //data members
  var $connection;
  var $instances = 0;
  var $ONLY_ONE_INSTANCE_ALLOWED = 5000;
 function __construct($hostname, $username, $password){
      if(!$this->connection = mysql_connect($hostname, $username,$password )){
        die("Unable to connect");
      }
}
 function __destruct(){
    $this->close();
  }

function createResultSet($strSQL, $databasename){
    $rs = new MySQLResultSet($strSQL, $databasename, $this->connection );
    return $rs;
  }
  function createQuery($strSQL, $databasename)
  {
      mysql_select_db($databasename);
      mysql_query($strSQL);
  }

function getConnection(){
    return $this->connection;
  }

function getVersionNumber(){
    //mysql_get_server_info
    return mysql_get_server_info();
  }

function close(){
    if(isset($this->connection)){
      mysql_close($this->connection);
      unset($this->connection);
    }
  }
}//end class
?>
